/**
 * 动态组件
 * @author Canaan
 * @date 2019/9/18 14:30
 */
export default {

  getters: {

    /**
     * 物料卡
     */
    materialCardCmp({navMenu}) {
      if (!navMenu) {
        return "materialCard";
      }
      if (navMenu.loading || !navMenu.options || navMenu.options.length <= 0) {
        return "materialCard";
      }

      let arr = navMenu.options.filter(item => {
        return item.menuCode === 'materialCard';
      });

      if (arr.length !== 1 || !arr[0].subs || arr[0].subs.length !== 1) {
        console.warn("物料卡配置异常！");
        return "materialCard";
      }

      return arr[0].subs[0].menuCode;
    },

  }

}
